﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace Southridge.View
{
    public static class SouthridgeBrushes
    {
        internal  enum SouthridgeBrushesKeys  
        {
            DataGridHeaderBackgroundBrush,
            DataGridHeaderMouseOverBackgroundBrush,
            DataGridHeaderBorderBrush,
            DataGridHeaderSortedBorderBrush,
            DataGridHeaderSortedBackgroundBrush,
            DataGridSelectedForegroundBrush, 

        };

        public static ComponentResourceKey DataGridHeaderBackgroundBrushKey 
        {
            get
            {
                return FindOrCreateKey(typeof(SouthridgeBrushes), SouthridgeBrushesKeys.DataGridHeaderBackgroundBrush);
            }          
        }
        public static ComponentResourceKey DataGridHeaderMouseOverBackgroundBrushKey
        {
            get
            {
                return FindOrCreateKey(typeof(SouthridgeBrushes), SouthridgeBrushesKeys.DataGridHeaderBackgroundBrush);
            }
        }
        public static ComponentResourceKey DataGridHeaderBorderBrushKey
        {
            get
            {
                return FindOrCreateKey(typeof(SouthridgeBrushes), SouthridgeBrushesKeys.DataGridHeaderBorderBrush);
            }
        }
        public static ComponentResourceKey DataGridHeaderSortedBorderBrushKey
        {
            get
            {
                return FindOrCreateKey(typeof(SouthridgeBrushes), SouthridgeBrushesKeys.DataGridHeaderSortedBorderBrush);
            }
        }
        public static ComponentResourceKey DataGridHeaderSortedBackgroundBrushKey
        {
            get
            {
                return FindOrCreateKey(typeof(SouthridgeBrushes), SouthridgeBrushesKeys.DataGridHeaderSortedBackgroundBrush);
            }
        }
        public static ComponentResourceKey DataGridSelectedForegroundBrushKey
        {
            get
            {
                return FindOrCreateKey(typeof(SouthridgeBrushes), SouthridgeBrushesKeys.DataGridSelectedForegroundBrush);
            }
        }






        static Dictionary<SouthridgeBrushesKeys, ComponentResourceKey> _keyPairs =
            new Dictionary<SouthridgeBrushesKeys, ComponentResourceKey>();

        static ComponentResourceKey FindOrCreateKey(Type t, SouthridgeBrushesKeys keyEnum)
        {
            ComponentResourceKey keytoreturn = _keyPairs[keyEnum];
            if (keytoreturn == null)
            {
                keytoreturn = new ComponentResourceKey(t, keyEnum);
                _keyPairs.Add(keyEnum, keytoreturn); 
            }
            return keytoreturn;  
        } 


    }
}
